安装Python

安装Python依赖

1
2
# CentOS7
yum install -y gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite sqlite-devel bzip2-devel curl wget ncurses-devel sqlite-devel gdbm-devel xz-devel tk-devel

安装pyenv

1
git clone https://github.com/pyenv/pyenv.git ~/.pyenv

配置bash_profile

1
2
3
4
5
6
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc

echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc

exec "$SHELL"

安装Python

1
2
3
4
5
pyenv install 3.6.5 -v

pyenv global 3.6.5

pyenv rehash

/root/.pyenv/versions/3.6.5/bin/python

1
pip install virtualenvwrapper pipenv
1
2
3
4
5
6
7
vim ~/.bashrc

#start virtualwrapper
VIRTUALENVWRAPPER_PYTHON=/root/.pyenv/versions/3.6.5/bin/python
export WORKON_HOME='~/.virtualenv'
source /root/.pyenv/versions/3.6.5/bin/virtualenvwrapper.sh
#end

pipenv –python=/root/.pyenv/versions/3.6.5/bin/python

因Supervisor现在不支持python3的版本需要安装Python 2.7.13

pyenv install 2.7.14 -v
pyenv global 2.7.14
pyenv rehash

更改pypi源

1
2
3
4
5
6
7
# 新建pip.conf存放目录
mkdir ~/.pip&&cd ~/.pip

cat >pip.conf<<EOF
[global]
index-url = https://pypi.douban.com/simple
EOF

×

纯属好玩

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

文章目录
  1. 1. 安装Python
    1. 1.1. 安装Python依赖
    2. 1.2. 安装pyenv
      1. 1.2.1. 配置bash_profile
      2. 1.2.2. 安装Python
    3. 1.3. 更改pypi源
,